package com.example.demo.app;

import com.example.demo.domain.app.param.AuthorizeParam;
import com.example.demo.domain.app.vo.AmountVO;
import com.example.demo.domain.app.vo.AuthorizeVO;
import com.example.demo.domain.app.vo.UserInfoDataVO;
import com.example.demo.domain.base.BaseResult;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * UserController
 *
 * @author haochen78
 * @date 2025/11/6 14:24
 **/
@RestController
@RequestMapping("/app/user")
public class AppUserController {

    @Autowired
    private UserService userService;

    @PostMapping("/wxapp/authorize")
    public BaseResult<AuthorizeVO> authorize(@RequestBody AuthorizeParam param) {
        return BaseResult.success(userService.authorize(param));
    }

    @PostMapping("/wxapp/login")
    public BaseResult<AuthorizeVO> login(@RequestBody AuthorizeParam param) {
        return BaseResult.success(userService.login(param));
    }

    @GetMapping("/check-token")
    public BaseResult<Void> checkToken() {
        return BaseResult.success();
    }

    @GetMapping("/detail")
    public BaseResult<UserInfoDataVO> userDetail() {
        return BaseResult.success(userService.detail());
    }

    @GetMapping("/shipping-address/default/v2")
    public BaseResult<Void> address() {
        return BaseResult.failure();
    }

    /**
     * 账户信息
     */
    @GetMapping("/amount")
    public BaseResult<AmountVO> amount() {
        return BaseResult.success(userService.amount());
    }

    /**
     * 资金明显
     */
    @PostMapping("/cashLog/v2")
    public BaseResult<Void> cashLog() {
        return BaseResult.success();
    }

    /**
     * 提现记录
     */
    @PostMapping("/withDraw/list")
    public BaseResult<Void> withDraw() {
        return BaseResult.success();
    }

    /**
     * 押金明细
     */
    @PostMapping("/deposit/list")
    public BaseResult<Void> deposit() {
        return BaseResult.success();
    }

    /**
     * 提现
     */
    @PostMapping("/withDraw/apply")
    public BaseResult<Void> apply() {
        return BaseResult.success();
    }

    /**
     * 充值规则
     */
    @PostMapping("/recharge/send/rule")
    public BaseResult<Void> recharge() {
        return BaseResult.success();
    }
}
